package com.itqf.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.itqf.serializer.MySalarySerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/16
 * @Time: 下午3:30
 */
@Data
public class Users {

    @JSONField(name = "userId")  //转成 json的key 会变为 userId
    private  int id;    //默认key是id
    @JSONField(serialzeFeatures =  SerializerFeature.WriteNullStringAsEmpty )
    private String username;
    private String password;
    private String sex;
    private int age;
    @JSONField(format = "yyyy-MM-dd hh:mm:ss")//  请求或者响应的数据是：json
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")//是表单字段
    private Date birthdate;
    @JSONField(serialize = false)//忽略字段
    private  String []hobby;

    //对工资字段特殊处理
    @JSONField(serializeUsing = MySalarySerializer.class)
    private double salary;



}
